#pragma once
#include "stdafx.h"

#include <boost/shared_ptr.hpp>
class QueueEntity;
enum OperatorState
{
	NORMAL,  //the output queue is not full
	BLOCKED, //the output queue is full, some elements are buffered in the operator 
};
class Operator
{
private:
	OperatorState state;
	std::list<boost::shared_ptr<QueueEntity> >inputQueueList;
	std::list<boost::shared_ptr<QueueEntity> >outputQueueList;
#ifdef DEBUG
	std::string id;
#endif
public:
	Operator(void);
	virtual ~Operator(void);
	virtual void execution(int executionTimes)=0;
	OperatorState getOperatorState(void);
	void setOperatorState(OperatorState operatorState);
	void addInputQueue(boost::shared_ptr<QueueEntity> queueEntity);
	std::list<boost::shared_ptr<QueueEntity> >& getInputQueueList(void);
	void addOutputQueue(boost::shared_ptr<QueueEntity> queueEntity);
	std::list<boost::shared_ptr<QueueEntity> >& getOutputQueueList(void);
#ifdef DEBUG
	void setId(std::string id);
	std::string getId(void);
#endif
};

